﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BartonExtension
{
    public static class DateTimeExtensions
    {
        private static DateTime Get1970Time()
        {
            return DateTime.Parse("1970-01-01 00:00:00");
        }
        public static DateTime GetDateTimeByMlliSeconds(double mlliseconds)
        {
            return Get1970Time().AddMilliseconds(mlliseconds);
        }

        public static double GetTimeIntervalFrom1970WithDateTime(this DateTime datetime)
        {
            var utcTime = Get1970Time();
            TimeSpan ts = datetime - utcTime;
            return ts.TotalMilliseconds;
        }
    }
}
